#ifndef IMAGEEDITOR_H
#define IMAGEEDITOR_H

#include <QGraphicsView>
class RectItem;
class ImageEditor : public QGraphicsView
{
    Q_OBJECT
public:
    explicit ImageEditor(QWidget *parent = 0);
    void loadPic(const QString &filename);
protected:
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
private:
    void drawEllipse(QRectF rc);
    void removeAllItems();
    QRectF checkRectF(QRectF rc);
private:
    bool m_drawing;
    QPointF m_startPoint;
    RectItem *m_curItem;
    QGraphicsPixmapItem *m_background;
};

#endif // IMAGEEDITOR_H
